﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;


public partial class mwc_admin_controls_addcontent : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void saveContent(object ob, EventArgs e)
    {
        try
        {
            string _title = article_title.Text;
            string _introtext = article_introtext.Text;
            string _fulltext = article_fulltext.Text;
            string _enable = article_enable.Checked == true ? "1" : "0";
            string conn = ConfigurationSettings.AppSettings["mwc_con"];
            string query = "INSERT INTO mwc_content(title,introtext,fulltext,enable) VALUES('" + _title + "','" + _introtext + "','" + _fulltext + "', "+ _enable +")";
            SqlConnection scn = new SqlConnection(conn);
            scn.Open();
            SqlCommand scmd = new SqlCommand(query, scn);
            scmd.ExecuteNonQuery();
        }
        finally
        {
            Response.Redirect("~/mwc_admin/Panel.aspx?option=listcontent");
        }
    }
    protected void Redirect2List(string msg)
    {
        Response.Redirect("~/mwc_admin/Panel.aspx?option=listcontent?msg="+msg);
    }
}
